<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>计划活动列表</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>CSS/style.css">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>JS/jquery-ui-1.11.2/jquery-ui.css">
	<script type="text/javascript" src="<%=basePath%>JS/jquery-ui-1.11.2/external/jquery/jquery.js"></script>
	<script type="text/javascript" src="<%=basePath%>JS/jquery-ui-1.11.2/jquery-ui.js"></script>
	<script type="text/javascript" src="<%=basePath%>JS/WongDatePicker.js"></script>
  </head>
  
  <body>
  		<div id="head-search">
   	 		<i class="home-path"></i><span class="path-font">活动管理 &nbsp;&nbsp;>>&nbsp;&nbsp;查看活动计划</span>
   		</div>
   		<div id="planActivityList" class="mainbody">
   		</div>
 
  </body>
  <script>
  $(function(){
	  //请求活动计划列表
	  $.ajax({
		 url:'<%=basePath%>getPlanActivityListAction',
		 type:'get',
		 typeData:'json',
		 timeout:1000,
		 beforeSend:befores,
		 error: errorFunc,
		 success:succFunc,	 
	 });
  });
  function befores(){}
  function errorFunc(){}
  //请求计划活动List成功后回调函数
  function succFunc(datas){
	  var json = eval(datas);
		 $.each(json,function(index,item){
			 var year = json[index].year;
			 var semester = json[index].semester;
			 var theme = json[index].theme;
			 var listId = json[index].listId;
			 $("#planActivityList").html($("#planActivityList").html()+"<div id='actList"+listId+"' class='actList'><span class='span'>年份："+year+"</span><span class='span'>学期："+semester+"</span><span class='span'>备注："+theme+
					 "</span><button id='planctivity"+listId+"btn'  class='wong-button-text-ui wong-button-blue' onclick='showPlanActivity("+listId+")'><span class='wong-ui-icon wong-icon-search'></span><span >查看</span></button></div>");
		 });
	  
  	}
  	//响应查看计划活动
  	function showPlanActivity(listId){
  		//alert(listId);
  		//请求当前活动List的相关计划活动
  		$.ajax({
  			 url:'<%=basePath%>getPlanActivityAction',
  			 type:'get',
  			 typeData:'json',
  			 data:{"listId":listId},
  			 timeout:1000,
  			 beforeSend:befores,
  			 error: errorFunc,
  			 success:getPlanActivityFunc,	 
  		 });
  	}
  
  	//响应请求当前活动list的计划活动
  	function getPlanActivityFunc(datas){
  		//alert(datas);
  		var json = eval(datas);
		 $.each(json,function(index,item){
			 var planDate = json[index].planDate;
			 var planId = json[index].planId;
			 var planAddr = json[index].planAddr;
			 var planTheme = json[index].planTheme;
			 var listId = json[index].listId;
			 var activityId = json[index].activityId;
			//展示当前活动列表 的计划活动
			 $("#actList"+listId).html($("#actList"+listId).html()+"<div id='act"+activityId+"' class='actlistdetail'>&nbsp;&nbsp;&nbsp;&nbsp;<span class='span'>活动"+(index+1)+"：<a href='<%=basePath%>activities/advise.jsp?planId="+planId+"'>"+planTheme+"</a></span><span class='span'>地点："+planAddr+"</span><span class='span'>时间："+planDate+"</span></div>");
			//去除查看当前活动列表的相关计划活动的按钮
			$("#planctivity"+listId+"btn").remove();
		 });
	  
  	}
  </script>
</html>
